package com.paper.tiger.easy.rpc.s.client.client;

import io.netty.channel.Channel;

import java.util.List;
import java.util.Objects;

/**
 * [简要描述]: 服务器级别的通道
 * [详细描述]:
 *
 * @author ZouHaiBo
 * @version 1.0, 2021/7/7 15:54
 * @since JDK 1.8
 */
public class LetterService
{
    private String ip;

    private Integer port;

    private List<Channel> channels;

    public String getIp()
    {
        return ip;
    }

    public void setIp(String ip)
    {
        this.ip = ip == null ? null : "".equals(ip.trim()) ? null : ip.trim();
    }

    public Integer getPort()
    {
        return port;
    }

    public void setPort(Integer port)
    {
        this.port = port;
    }

    public List<Channel> getChannels()
    {
        return channels;
    }

    public void setChannels(List<Channel> channels)
    {
        this.channels = channels;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }
        LetterService that = (LetterService) o;
        return ip.equals(that.ip) && port.equals(that.port);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(ip, port);
    }
}
